package com.zw.langchainai.config;

import dev.langchain4j.memory.ChatMemory;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置chatMemory
 */
@Configuration
public class MemoryChatAssistantConfig {

    @Bean(name = "chatMemory")
    public ChatMemory chatMemory() {
        // 设置聊天记忆记录message的最大数
        return MessageWindowChatMemory.withMaxMessages(10);
    }
}
